package com.woniuxy.portal.client;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniuxy.user.dto.AddUserDto;
import com.woniuxy.user.entity.SystemUser;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "sys-user")
public interface UserApi {

    @GetMapping("/getPhone")
    SystemUser getUser(@RequestParam("userPhone") String userPhone);

    @PostMapping("/batchDelete")
    ResponseEntity<String> batchDelete(@RequestBody List<Integer> ids);

    @GetMapping("/getByUserSex")
    Page<SystemUser> getByUserSex(@RequestParam("userSex")Integer userSex,
                                  @RequestParam("pageNum")Integer pageNum,
                                  @RequestParam("pageSize") Integer pageSize);

    @PostMapping("/adduser")
    ResponseEntity addUser(@RequestBody AddUserDto addUserDto);

    @GetMapping("/getByUserName")
    Page<SystemUser> getByUserName(@RequestParam("userName") String userName,
                                          @RequestParam("pageNum") Integer pageNum,
                                          @RequestParam("pageSize") Integer pageSize);
}
